

package jetbrains.buildServer.server.rest.errors;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
import jetbrains.buildServer.server.rest.jersey.ExceptionMapperBase;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;

/**
 * User: Yegor Yarko
 * Date: 30.03.2009
 * <p/>
 * This will hopefully report Jersey-originated errors with more details
 */
@Provider
@Component
public class AuthorizationFailedExceptionMapper extends ExceptionMapperBase<AuthorizationFailedException> {
  @Override
  public ResponseData getResponseData(@NotNull final AuthorizationFailedException e) {
    return new ResponseData(Response.Status.FORBIDDEN, "Access denied. Check the user has enough permissions to perform the operation.");
  }
}